Skip to content

NO TICKET: maintain contact schema | skip second contact if no info | persist invalid legacy phone data#216

Merged
jirhiker merged 13 commits into
stagingfrom
jab-contact-schema-fix
Nov 4, 2025
Merged

NO TICKET: maintain contact schema | skip second contact if no info | persist invalid legacy phone data#216
jirhiker merged 13 commits into
stagingfrom
jab-contact-schema-fix

Conversation

@jacob-a-brown

@jacob-a-brown jacob-a-brown commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • The contact and phone schema should not accommodate invalid legacy data (mostly phone numbers)
  • We need a way to persist that invalid legacy phone data so it's still usable by AMMP colleagues when needed
  • Second contacts from OwnersData should not be added if all Second fields are null

How

Implementation summary - the following was changed / added / removed:

  • Added new IncompleteNMAPhone model to store that data
  • Made Phone.phone non-nullable
  • Skip trying to add a second contact if any of SecondFirstName, SecondLastName, SecodnCtctEmail, or SecondCtctPhone are null

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Instead of storing the invalid (incomplete) phone numbers in the contact model I decided to put them in a separate class. This way the contact model won't be compromised and amended for invalid legacy data. We can still easily display that invalid data, and if/when we decide to no longer display that data we can remove it from ContactResponse
  • @ksmuczynski and I thought that IncompleteNMAPhone best describes the data. It is invalid in terms of Pydantic validations, but they still work (if an area code can be determined). We thought this would best communicate the state of the data to users
    • If we want to to set a naming standard for "invalid" or "incomplete` legacy data that we want to preserve (for now), should we come up with a naming convention? Is this good enough?
  • An aside: I changed the names of the metric and transfer logs to make them look less cluttered and easier to read at a glance. ":" can't be in a file name (at least on Windows), which is what instigated this update.)
  • When someone queries GET /contact/{contact_id}/phone should the invalid legacy records be returned too? I'm leaning toward no because they are in a separate table, but could see an argument for their inclusion

Comment thread transfers/contact_transfer.py Fixed
@codecov-commenter

codecov-commenter commented Oct 31, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.69231% with 21 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
transfers/contact_transfer.py 5.00% 19 Missing ⚠️
transfers/metrics.py 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
db/contact.py 100.00% <100.00%> (ø)
schemas/contact.py 100.00% <100.00%> (ø)
services/contact_helper.py 100.00% <ø> (ø)
tests/conftest.py 86.07% <100.00%> (-7.36%) ⬇️
tests/test_contact.py 100.00% <100.00%> (ø)
transfers/logger.py 80.00% <100.00%> (+10.76%) ⬆️
transfers/metrics.py 32.00% <0.00%> (ø)
transfers/contact_transfer.py 10.12% <5.00%> (-0.17%) ⬇️

... and 3 files with indirect coverage changes

@jacob-a-brown jacob-a-brown changed the title NO TICKET: maintain contact schema & persist invalid legacy phone data NO TICKET: maintain contact schema | skip second contact if no info | persist invalid legacy phone data Oct 31, 2025
Comment thread transfers/contact_transfer.py Outdated
@jirhiker jirhiker merged commit 39a3887 into staging Nov 4, 2025
6 checks passed
@TylerAdamMartinez TylerAdamMartinez deleted the jab-contact-schema-fix branch February 5, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants